<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="../js/jquery-1.10.2.min.js"></script>
  
<title>添加纱</title>
</head>
<body>

	                                <form id="form">
			                                <div class="row">
			                                	<label class="only">类型：</label>
												<div class="radio-inline"><label><input type="radio" name="type" value="1" onchange="">主布</label></div>
												<div class="radio-inline"><label><input type="radio" name="type" value="2" onchange="">配布</label></div>
												<div class="radio-inline"><label><input type="radio" name="type" value="3" onchange="">纱</label></div>
											</div>
												<input name="sampleId" value=<%=request.getAttribute("sampleId")%> type="hidden">
													
			                                	<div class="row"><lable class="only">商品图片：</lable><input type="text" name="img" ></div>
			                                	
			                                	<div class="row"><lable class="only">型号：</lable><input type="text" name="serialnumber"></div>
			                                	
			                                	<div class="row"><lable class="only">材质：</lable><input type="text"  name="material"></div>
			                                	
			                                	<div class="row"><lable class="only">花距：</lable><input type="text" name="spur"></div>
			                                	
			                                	<div class="row">
			                                		<lable class="only">规格：</lable> 定高<input type="radio"name="breadthStatus" value='0'>定宽<input type="radio" name="breadthStatus" value='1'> 
			                                	</div>
			                                	
			                                	<div class="row"><lable class="only">幅宽：</lable><input type="text" name="breadth">米</div>
			                                	
			                                	<div class="row">
			                                		<lable class="only">拼接方式：</lable> 不拼接<input type="radio" name="putTogether" value="0"  >竖拼<input type="radio" name="putTogether" value="1" >横拼<input type="radio" name="putTogether" value="2">
			                                	</div>
			                                	
			                                	
			                                	<div class="row"><lable class="only">商品图片：</lable><input type="text" name="img"></div>
			                             
			 									
			                                	<div class="row">
			                                		<lable class="only">能否倒幅： </lable>是 <input type="radio" name="inverte" value="1" >否<input type="radio"  name="inverte" value="0"> 
			                                	</div>
			                                	
			                                	<div class="row"><lable class="only">采购价：</lable><input type="text" name="purchasePrice"></div>
			                                	
			                                	<div class="row"><lable class="only">出售价：</lable><input type="text" name="price"  >元</div>
			                                	
			                                	
			                                	<div class="row"><lable class="only">产地：</lable><input type="text" name="produceArea" ></div>
			                                	
			                              
			                                	<div class="row"><lable class="only">打孔价格：</lable><input type="text" name="holePrice" ></div>
			                                	
			                                	<div class="row"><lable class="only">韩折价格：</lable><input type="text" name="zhePrice" ></div>
			                                
			                                	
			                                	<div class="row"><lable class="only">纱韩折价格：</lable><input type="text" name="ssPrice" ></div>
			                                	
			                                	<input type="button" value="提交" id="submit">
			                                
			                                </form>
			                             
	<script type="text/javascript">
	
	function updateString(data){
    data=data.replace(/&/g,"\",\"");  
    data=data.replace(/=/g,"\":\"");  
    data="{\""+data+"\"}";  	
    return data;
 }
	
		$("#submit").click(function(){
			
			var composition = $("#form").serialize();
			composition=decodeURIComponent(composition,true);
			composition = updateString(composition);
			$.ajax({
				url:'/bukeManage/shoppingmall/addComposition.do',
				data:{"composition":composition},
				type:"post",
				success:function(data){
					<%-- if(data=="0"){
						alert("添加成功");
						window.location.href = "/bukeManage/shoppingmall/upGoods.do?sampleId=<%=request.getAttribute("sampleId")%>"
					}else if(data=="1"){
						alert("添加失败");
					} --%>
					alert("添加成功");
					window.location.href = "/bukeManage/shoppingmall/upGoods.do?sampleId=<%=request.getAttribute("sampleId")%>"
				}
			});
			
		});
			
	
	</script>

</body>
</html>